<template>
  <div>
    <div class="dialogcommidity">
    <el-dialog
      ref="dislogRef"
      :visible.sync="dialogVisible"
      lock-scroll
      height="50%"
      :width="fullScreen ? '100vw' : '65vw'"
      :close-on-click-modal="false"
      :before-close="onCancelRow"
      :fullscreen="fullScreen"
      :modal="isMask"
    >
      <div slot="title" class="header_title">
        <span class="title_span">选择商品</span>
        <div class="title_search">
          <div>
            <el-input
              @change="onQuery"
              v-model="queryData.queryParam"
              placeholder="请输入商品名称\条码\编码\规格\拼音码"
            ></el-input>
            <el-button type="primary" @click="onQuery">搜索</el-button>
            <el-button type="primary" @click="onSelectRow">选择</el-button>
            <el-button @click="onAddRow" style="border: 1px solid #dcdfe6"
              ><span style="color: #666">新增</span></el-button
            >
            <el-button @click="onCancelRow" style="border: 1px solid #dcdfe6"
              ><span style="color: #666">取消</span></el-button
            >
            <i @click="onShowColumn()" class="set_up el-icon-s-tools"></i>
          </div>
          <div>
            <!-- <i @click="toDetail()" class="set_up el-icon-full-screen"></i> -->
            <el-image
              :src="require('@/assets/fullscreen.png')"
              style="width: 23px; height: 23px"
              @click="onFullScreenShow()"
            ></el-image>
          </div>
        </div>
      </div>
      <div class="content_div" :style="{ height: fullScreen ? '90vh' : '60vh' }">
        <div class="info_table">
          <div class="div_tree">
            <div class="tree_div1">商品类别</div>
            <div class="tree_input">
              <p>
                <input type="text" placeholder="查找" v-model="GoodsTypeName" />
                <span>
                  <i class="el-icon-search"></i>
                </span>
              </p>
            </div>
            <div class="tree_structure">
              <el-tree
                :data="treeData"
                node-key="label"
                :props="defaultProps"
                highlight-current
                default-expand-all
                :expand-on-click-node="false"
                @node-click="handleNodeClick"
                ref="tree"
                :filter-node-method="filterNode"
              ></el-tree>
            </div>
          </div>
          <div class="div_table">
            <div class="table_content">
              <el-table
                ref="tableCommodity"
                border
                :data="tableData.records"
                @row-click="onClickRow"
                @row-dblclick="ondbClickRow"
                :row-class-name="tableRowClassName"
                height="100%"
                v-loading="tableDataLoading"
                element-loading-text="拼命加载中"
                element-loading-spinner="el-icon-loading"
                element-loading-background="rgba(0, 0, 0, 0)"
                @select="onTableSelect"
                @selection-change="handleSelectionChange"
                :row-key="getRowKeys"
                :key="tableKey"
              >
                <!-- @header-dragend="onHandleDrag" -->
                <el-table-column
                  v-if="!isRadio"
                  type="selection"
                  width="50"
                  :reserve-selection="true"
                ></el-table-column>
                <el-table-column :resizable="false" label="序号" type="index" width="50"></el-table-column>
                <template v-for="(item, i) in newColumnData">
                  <el-table-column
                    :show-overflow-tooltip="true"
                    v-if="item.zidingyiState"
                    :key="i"
                    :prop="item.props"
                    :label="item.morenName"
                    min-width="150px"
                    :width="item.morenName=='商品名称'?'300px':item.cellWidth"
                    
                  >
                  <!-- 如果是商品图片字段，则显示image,goodsImg如果没有图片返回null，如果一张返回一个图片地址，如果是多个图片返回的是用逗号隔开的图片地址，只用取第一张图片显示即可 -->
                    <template slot-scope="scope">
                      <template v-if="item.props === 'goodsImg' && scope.row[item.props] && typeof scope.row[item.props] === 'string'">
                        <el-image
                          :src="scope.row[item.props].includes(',') ? scope.row[item.props].split(',')[0] : scope.row[item.props]"
                          style="width: 50px; height: 50px"
                        ></el-image>
                      </template>
                      <template v-else-if="item.morenName == '商品名称'">
                        <span style="width: 100%;" class="goods-name">{{ scope.row[item.props]  }}</span>
                      </template>
                      <template v-else>
                        {{ scope.row[item.props] }}
                      </template>
                    </template>
                  </el-table-column>
                </template> 
                <!-- <el-table-column
                v-for="(item, i) in newColumnData"
                :show-overflow-tooltip="true"
                :key="i"
                :prop="item.props"
                :label="item.morenName"
                min-width="150px"
                ></el-table-column>-->
              </el-table>
            </div>
            <div class="table_pagination">
              <p class="total_div">共{{ tableData.total }}条</p>
              <div class="pagination_div">
                <el-pagination
                  background
                  @size-change="handleSizeChange"
                  @current-change="handleCurrentChange"
                  :current-page.sync="currentPage"
                  :page-sizes="[20, 50, 100, 200]"
                  :page-size="pagesize"
                  layout="jumper, prev, pager,next, sizes"
                  :total="tableData.total"
                ></el-pagination>
              </div>
            </div>
          </div>
        </div>
        <div></div>
        <!-- <div class="info_button">
          <el-button @click="onAddRow">新增</el-button>
          <div style="display: flex;">
            <el-button type="primary" @click="onSelectRow">选择</el-button>
            <el-button @click="onCancelRow">取消</el-button>
          </div>
        </div> -->
      </div>
    </el-dialog>
  </div>
    <!-- 新增商品弹框 -->
    <DialogCommodityShopAdd
      ref="commodityAddRef"
      :isMask="isMask"
      @dialogVisibleClose="onCloseAddCommodity"
      @onAddSubmit="onAddCommodity"
    ></DialogCommodityShopAdd>
    <!-- 列配置弹框 -->
    <CConfiguration
      ref="setColumnRef"
      :isMask="isMask"
      :columnDataArr="newColumnData"
      :defaultColumnDataArr="defaultColumnData"
      orderType="采购入库单"
      @onSaveColumn="onSaveColumn"
    ></CConfiguration>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { getAction } from '@/api/manage'
import DialogCommodityShopAdd from '@/views/components/dialogCommodityShopAdd'
import CConfiguration from '@/components/c_column/columnConfiguration1'
import { getSystemParamsByName, sysConfig } from '@/utils/index'
export default {
  name: 'dialogCommodity',
  computed: {
    ...mapGetters(['name']),
  },
  components: { DialogCommodityShopAdd, CConfiguration },
  props: {
    storehouseId: '',
    companyId: '',
    orderName: '',
    accessType: '',
    isMask: {
      type: Boolean,
      default: true,
    },
    isRadio: {
      type: Boolean,
      default: false,
    },
  },
  created() {
    this.selectTitle()
    // console.log(this.$route.query, 'this.$route.query')
    // console.log(this.$route.query.id, 'this.$route.query.id')
    // this.storehouseId=this.$route.query.id
    // console.log(this.storehouseId,'this.storehouseId');

    // if(this.$route.query.id){
    //   // this.storehouseId=this.$route.query.id
    //   // this.getTableData()
    // }
  },
  mounted() {},
  computed: {
    isInputManyGoods() {
      return sysConfig().allow_multi_line_entry_goods_info
    },
  },
  watch: {
    dialogVisible(val) {
      if (val == true) {
        this.getData()
      } else {
        this.queryData.queryParam = ''
        this.GoodsTypeName = ''
      }
    },
    GoodsTypeName(val) {
      this.$refs.tree.filter(val)
    },
  },
  data() {
    return {
      GoodsTypeName: '',
      getInventory: true, //是否需要获取可用数量相关内容
      queryData: {
        queryParam: '',
        goodsName: '',
        xghGoodsTypeId: '',
      },
      pagesize: 20, //每页的数据条数
      currentPage: 1, //默认开始页面
      tableData: {},
      tableDataLoading: false,
      newColumnData: [
        {
          morenName: '商品图片',
          props: 'goodsImg',
          zidingyiState: true,
        },
        {
          morenName: '商品编码',
          props: 'goodsNumber',
          zidingyiState: true,
        },
        {
          morenName: '条形码',
          props: 'barCode',
          zidingyiState: true,
        },
        {
          morenName: '商品名称',
          props: 'goodsName',
          zidingyiState: true,
          noModify: true,
        },
        {
          morenName: '基本单位',
          props: 'baseUnit_dictText',
          zidingyiState: true,
        },
        {
          morenName: '规格',
          props: 'specs',
          zidingyiState: true,
        },
        {
          morenName: '库存数量',
          props: 'number',
          zidingyiState: true,
          noModify: true,
        },
        {
          morenName: '可用数量',
          props: 'useNumber',
          zidingyiState: true,
          noModify: true,
        },
        {
          morenName: '辅助单位',
          props: 'supUnit',
          zidingyiState: true,
        },
        {
          morenName: '辅助单位规格',
          props: 'specsall',
          zidingyiState: true,
        },
        {
          morenName: '商品类别',
          props: 'xghGoodsTypeId_dictText',
          zidingyiState: true,
        },
        {
          morenName: '零售价',
          props: 'retailPrice',
          zidingyiState: true,
        },
        {
          morenName: '预设售价一',
          props: 'presetPriceOne',
          zidingyiState: true,
        },
        {
          morenName: '预设售价二',
          props: 'presetPriceTwo',
          zidingyiState: true,
        },
        {
          morenName: '预设进价',
          props: 'presetBidPrice',
          zidingyiState: true,
        },
        {
          morenName: '商品性质',
          props: 'goodsNatureId_dictText',
          zidingyiState: true,
        },
        {
          morenName: '预设折扣一',
          props: 'discountRatioOne',
          zidingyiState: true,
        },
        {
          morenName: '预设折扣二',
          props: 'discountRatioTwo',
          zidingyiState: true,
        },
        {
          morenName: '拼音码',
          props: 'pinyinCode',
          zidingyiState: true,
        },
        {
          morenName: '备注',
          props: 'goodsRemark',
          zidingyiState: true,
        },
      ],
      treeData: [],
      defaultProps: {
        children: 'children',
        label: 'label',
      },
      selectRow: {}, //当前选择的数据
      dialogVisible: false, // 新增弹框
      showGoodsStoreNumber: false,
      showGoodsUsableNumber: false,
      fullScreen: false,
      // 传递给新增商品的初始化值
      newData: {
        id: '',
        goodsName: '', //商品名称
        pinyinCode: '',
        goodsNumber: '', //商品编码
        productionAddress: '', //产地
        goodsNatureId: '1', //商品性质id 1：服务、2.劳务 3.商品（无成本）
        goodsNatureName: '',
        xghGoodsTypeId: '', //商品类别
        xghGoodsTypeName: '',
        costCalculation: '1', //成本核算
        barCode: '', //条形码
        specs: '', //规格
        defaultUnit: '', //默认单位
        baseUnit: '', //基本单位
        multiPriceStatus: false, //多单位状态 0:开启 1:关闭
        priceStatus: true, //价格管理状态 0:开启 1:关闭
        stockWarningStatus: true, //库存预警状态 0:开启 1:关闭
        multiStockWarningStatus: false, //分库存预警状态 0:开启 1:关闭
        stockStatus: false, //期初库存状态 0:开启 1:关闭
        multiStockStatus: false, //分期初库存状态 0:开启 1:关闭
        goodsRemark: '', //备注

        specialFunction: false, //商品特殊功能模块，1开启，0关闭
        specialFunctionColorId: '', //
        specialFunctionColorStr: '', //
        specialFunctionSizeId: '', //关联尺码属性id（多个逗号分隔）
        specialFunctionSizeStr: '', //
        specialFunctionStr: '', //
        specialFunctionType: '', //
        specialFunctionTypeColorSize: false, //商品特殊功能模块-颜色尺码
        goodsManyNorms: [
          //多单位及价格表数据
          {
            fakeId: '0',
            isDefault: '1', //是否是基本单位
            unitType: '基本单位', //单位类别 1.基本单位2.辅助单位
            unit: '', //单位
            scale: 1, //换算比例
            retailPrice: '', //零售价
            barCode: '', //条形码
            specs: '', //规格
            vipPric: '', //会员价
            presetPriceOne: '', //预设售价1
            presetPriceTwo: '', //预设售价2
            presetBidPrice: '', //预设进价
            discountRatioOne: '', //预设折扣1
            discountRatioTwo: '', //预设折扣2
            xhState: true,
          },
        ],
        goodsWarnings: [
          //仓库预警数据
          {
            fakeId: '0',
            xghStorehouseId: '', //仓库id
            xghStorehouseName: '总数量预警',
            miniStock: 0, //最低库存
            highStock: 0, //最高库存
            xhState: true,
          },
        ],
        initialInventoryInfos: [],
      },
      multipleSelection: [], // 存储多选的数据
      selectsdata: [],
      tableDatas: [],
      tableKey: '',
      updateId: '', // 修改列配置时返回的id
      defaultColumnData: [],
      goodIds: [],
      addFlag: false, // 是否新增
      deleteRows: [],
    }
  },
  methods: {
    onHandleDrag(newWidth, oldWidth, column, event) {
      console.log(newWidth)
      console.log(oldWidth)
      console.log(column)
      console.log(event)
    },
    // 查询
    async selectTitle() {
      let obj = await this.$setColumn.selectColumn('单据商品选择')
      if (obj.code === 200) {
        this.updateId = obj.updateId
        this.newColumnData = JSON.parse(JSON.stringify(obj.columnData))
      } else if (obj.code === 500) {
        let id = await this.$setColumn.addColumn('单据商品选择', this.newColumnData, 0, this.updateId)
        this.updateId = id
      }
    },
    // 打开列配置弹框
    onShowColumn() {
      let list = this.$options.data().newColumnData
      let config = sysConfig()
      list.forEach((item) => {
        if (item.props == 'number') {
          // 库存数量
          if (config.show_shorehouse_num) {
            item.noModify = false
          } else {
            item.zidingyiState = false
            item.noModify = true
          }
        } else if (item.props == 'useNumber') {
          // 可用数量
          if (config.show_available_num) {
            item.noModify = false
          } else {
            item.zidingyiState = false
            item.noModify = true
          }
        }
      })
      this.defaultColumnData = list
      this.$refs.setColumnRef.loadData(this.newColumnData, list)
      // this.$refs.setColumnRef.dialogVisible = true
    },
    // 列配置修改后数据获取
    async onSaveColumn(value) {
      this.newColumnData = value
      let res = await this.$setColumn.editColumn('单据商品选择', this.newColumnData, this.updateId)
      if (res.code == 200) {
        this.$elMessage.success(res.message)
      } else {
        this.$elMessage.error(res.message)
      }
    },
    tableRowClassName({ row }) {
      if (row.id === this.selectRow.id) {
        return 'select_row'
      }
    },
    // 获取数据
    getData() {
      this.currentPage = 1
      this.handleDataColumn()
      this.getTreeData()
      this.getTableData()
    },
    // 处理数据列,根据系统配置，决定选择商品时是否显示可用数量、库存数量
    handleDataColumn() {
      let config = sysConfig()
      this.newColumnData.forEach((item) => {
        if (item.props == 'number') {
          // 库存数量
          if (config.show_shorehouse_num) {
            item.noModify = false
          } else {
            item.zidingyiState = false
            item.noModify = true
          }
        } else if (item.props == 'useNumber') {
          // 可用数量
          if (config.show_available_num) {
            item.noModify = false
          } else {
            item.zidingyiState = false
            item.noModify = true
          }
        }
      })

      // let useNumber = this.newColumnData.find(item => item.props == 'useNumber').zidingyiState
      // let number = this.newColumnData.find(item => item.props == 'number').zidingyiState
      // this.getInventory = useNumber || number || this.accessType == 'out'
    },
    // 获取类别数据
    getTreeData() {
      let data = {
        GoodsTypeName: this.GoodsTypeName,
      }
      getAction('/xghGoodsType/xghGoodsType/typeList', {}).then((res) => {
        if (res.code === 200) {
          let list = res.result
          let result = this.getTreeDataByList(list, '0', '')
          this.treeData = [
            {
              id: '',
              label: '全部',
              children: result,
            },
          ]
        }
      })
    },
    getTreeDataByList(list, parentId, parentName) {
      let data = []
      for (let index = 0; index < list.length; index++) {
        const element = list[index]
        if (element.pid == parentId) {
          data.push({
            ...element,
            id: element.id,
            label: element.goodsTypeName,
            parentId,
            parentName,
            children: this.getTreeDataByList(list, element.id, element.companyTypeName),
          })
        }
      }
      return data
    },
    // 获取表格数据
    getTableData(page) {
      let data = {
        ...this.queryData,
        storehouseId: this.storehouseId,
        pageSize: this.pagesize,
        pageNo: page || 1,
      }
      data.companyId = this.companyId
      data.configType = this.orderName === 'salesBill' ? '1' : '2'
      this.tableDataLoading = true
      this.tableData = {}
      getAction('/xghGoods/xghGoods/listNew', data)
        .then((res) => {
          this.tableDataLoading = false
          if (res.code === 200) {
            this.currentPage = page || 1
            this.tableData = res.result
            this.tableDatas = res.result.records
            this.tableKey = Math.random()
            let goodIds = JSON.parse(JSON.stringify(this.goodIds))
            let existingIds = this.multipleSelection.map((item) => item.id)
            // console.log(1111,goodIds);
            // console.log(2222,existingIds);
            if (goodIds.length < existingIds.length && this.goodIds.length != 0 && this.addFlag == false) {
              console.log(1111)
              existingIds.forEach((item, index) => {
                if (!goodIds.includes(item)) {
                  this.multipleSelection = this.multipleSelection.filter((element) => element.id != item)
                }
              })
            }
            existingIds = this.multipleSelection.map((item) => item.id)
            // console.log(333,existingIds);
            // 从记录中跳转
            if (goodIds.length > existingIds.length) {
              // console.log('记录进',goodIds);
              this.tableDatas.forEach((item) => {
                if (goodIds.includes(item.id)) {
                  this.$nextTick(() => {
                    this.$refs.tableCommodity.toggleRowSelection(item, true) // toggleRowSelection 切换表格某行选中状态
                  })
                }
              })
            }
            this.tableDatas.forEach((item) => {
              if (existingIds.includes(item.id)) {
                this.$nextTick(() => {
                  this.$refs.tableCommodity.toggleRowSelection(item, true) // toggleRowSelection 切换表格某行选中状态
                })
              }
            })
          }
          this.tableData.records.forEach((item) => {
            item.disabled_status = item.disabled_status == 0 ? true : false
            //20240912逻辑修改，优先级不从这里获取了
            if (item.xghPriorityConfig) {
              let dt = item.xghPriorityConfig.find((mx) => mx.val) || {}
              item.salePriceShow = dt.val
            }
            // 库存预警，放在接口里返回，不再挨个发起请求去调了
            if (item.goodsInventoryVos && item.goodsInventoryVos.length > 0) {
              let result = item.goodsInventoryVos[0]
              item.useNumber = result.useNumber
              item.number = result.number
              item.costPrice = result.costPrice
              item.formulaList = result.formulaList
            }
            // if (this.getInventory) {
            //   this.getInventoryById(item)
            // }
          })
        })
        .catch(() => (this.tableDataLoading = false))
    },
    getInventoryById(item) {
      let data = {
        storehouseId: this.storehouseId,
        goodsId: item.id,
      }
      getAction('/xghGoods/xghGoods/getInventoryByGoodId', data).then((res) => {
        this.tableDataLoading = false
        if (res.code === 200) {
          let result = res.result || {}
          item.useNumber = result.useNumber
          item.number = result.number
          item.costPrice = result.costPrice
          item.formulaList = result.formulaList
        }
      })
    },
    // 新增
    onAddRow() {
      const that = this
      this.$nextTick(() => {
        that.$refs.commodityAddRef.show(that.newData,{})
      })
    },
    // 获取新增商品数据
    onAddCommodity() {
      // this.getTableData()
      this.newData = this.$options.data().newData
    },
    // 关闭新增商品时清空
    onCloseAddCommodity() {
      this.getData()
      this.newData = this.$options.data().newData
    },
    // 搜索
    onQuery() {
      this.getTableData()
    },
    // 全屏显示
    onFullScreenShow() {
      this.fullScreen = !this.fullScreen
    },
    // 全屏显示
    toDetail() {
      this.$router.push({
        name: 'commodityInfo',
      })
    },
    // 搜索树形结构数据
    onSelectTree() {
      this.getTreeData()
    },
    // 触发树形当前节点
    handleNodeClick(data) {
      if (data.superiorId === 0) {
        this.queryData.xghGoodsTypeId = ''
      } else {
        this.queryData.xghGoodsTypeId = data.id
      }
      this.nowLabel = data.goodsTypeName
      this.getTableData()
    },
    getRowKeys(row) {
      return row.id
    },
    // 选中当前行
    onClickRow(row) {
      if (this.isRadio) {
        this.selectRow = row
      } else {
        let ac = this.multipleSelection.find((item) => item.id == row.id)
        console.log(ac)
        if (ac) {
          let index = this.goodIds.indexOf(row.id)
          if (index != -1 && index < this.goodIds.length) {
            this.goodIds.splice(index, 1)
          }
        }
        this.$refs.tableCommodity.toggleRowSelection(row)
      }
    },
    ondbClickRow(row) {
      // this.selectRow = row
      // 双击选择该商品
      // 2024 09 18 修改 begin
      if (this.isInputManyGoods) {
        this.$refs.tableCommodity.clearSelection() //清除选中的数据
      }
      // this.$refs.tableCommodity.clearSelection() //清除选中的数据
      this.$refs.tableCommodity.toggleRowSelection(row)
      // 2024 09 18 修改 end
      // this.multipleSelection = [row]
      // 2024 09 18 修改 begin
      setTimeout(() => {
        this.onSelectRow()
      }, 200)
      // this.onSelectRow()
      // 2024 09 18 修改 end
    },
    // 触发表格多选按钮
    handleSelectionChange(val) {
      // this.multipleSelection = val
      this.addFlag = true
      // 创建一个新的 Set 来存储唯一的 id
      let uniqueIds = new Set(this.multipleSelection.map((item) => item.id))
      let uniqueIds2 = new Set(this.tableDatas.map((item) => item.id))

      let temp = new Set(val.map((item) => item.id))
      // 遍历新选中的项
      val.forEach((item) => {
        if (!uniqueIds.has(item.id)) {
          this.multipleSelection.push(item)
          uniqueIds.add(item.id)
        }
      })
      // 将集合转换成数组
      let uniqueIds2Array = Array.from(uniqueIds2)
      // 找到当前数组中没有勾选上的项
      let uncheckedArr = uniqueIds2Array.filter((item) => !temp.has(item))
      // console.log('uncheckedArr', uncheckedArr)
      if (uncheckedArr.length > 0) {
        this.multipleSelection = this.multipleSelection.filter((elem) => !uncheckedArr.includes(elem.id))
      }
      // console.log('multipleSelection 合并后的', this.multipleSelection)
    },
    onTableSelect(rows, row) {
      let selected = rows.length && rows.indexOf(row) !== -1
      console.log(selected) // true就是选中，0或者false是取消选中
      if (!selected) {
        let index = this.goodIds.indexOf(row.id)
        if (index != -1 && index < this.goodIds.length) {
          this.goodIds.splice(index, 1)
        }
      }
    },
    // 选中后传递给父组件
    onSelectRow() {
      if (this.isRadio) {
        var objStr = JSON.stringify(this.selectRow)
        if (objStr == '{}') {
          this.$elMessage.warning('请选择一条信息')
        } else {
          this.$emit('onSelectCommodityMultiple', this.selectRow)
          this.dialogVisible = false
          this.selectRow = {}
        }
      } else {
        if ((this.multipleSelection == null || this.multipleSelection.length === 0) && this.goodIds.length == 0) {
          this.$elMessage.warning('请选择一条信息')
        } else {
          this.$emit('onSelectCommodityMultiple', this.multipleSelection, this.goodIds)
          this.dialogVisible = false
          this.addFlag = false
          this.$refs.tableCommodity.clearSelection() //清除选中的数据
        }
      }
    },
    // 取消
    onCancelRow() {
      this.$emit('onCancelCommodity', this.selectRow)
      this.dialogVisible = false
      this.addFlag = false
      // this.multipleSelection = []
    },
    // 获取每页几条数据
    handleSizeChange(val) {
      this.pagesize = val
      this.getTableData()
    },
    // 获取当前第几页
    handleCurrentChange(val) {
      this.currentPage = val
      this.getTableData(val)
    },
    // 商品类别数据筛选
    filterNode(value, data) {
      if (!value) return true
      return data.label.indexOf(value) !== -1
    },
  },
}
</script>

<style lang="scss" scoped>
.goods-name{
  width: 100%;
  line-height: 18px;
  white-space: normal;
  word-wrap: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;

}
.dialogcommidity ::v-deep .el-dialog {
  min-width: 850px;
  // width: 65vw;

  .el-dialog__body {
    padding: 0;
  }

  .el-dialog__header {
    width: 100%;
    height: 50px;
    box-sizing: border-box;
    padding: 0 10px;
    border-bottom: 1px solid #eeeeee;
    // display: flex;
    // align-items: center;
    // justify-content: space-between;

    .el-dialog__headerbtn {
      position: static;

      .el-icon-close {
        color: #999;
        font-size: 30px;
      }
    }
  }

  .header_title {
    width: 100%;
    display: flex;
    align-items: center;

    .title_span {
      white-space: nowrap;
      font-size: 24px;
      color: #666;
      font-weight: 600;
      margin-right: 50px;
      width: max-content;
      flex-shrink: 0;
      padding: 0 10px;
    }

    .title_search {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
      box-sizing: border-box;
      padding: 0 10px;

      > div {
        display: flex;
        align-items: center;

        .el-input {
          width: 4.725295rem;
          height: 30px;
          margin-right: 0.112507rem;

          .el-input__inner {
            height: 30px;
            border-color: #dddddd;
            box-sizing: border-box;
            padding: 0 5px;
            background: #fff;
            font-size: 12px;
            color: #666;

            &::placeholder {
              font-size: 12px;
              color: #c1c1c1;
            }
          }
        }

        .el-button {
          width: 60px;
          height: 30px;
          text-align: center;
          box-sizing: border-box;
          display: flex;
          align-items: center;
          justify-content: center;
          font-size: 12px;
          border-radius: 5px;
          border: none;
          margin-right: 15px;
          margin-left: 0;

          span {
            color: #fff;
            font-size: 12px;
            font-weight: normal;
          }
        }
      }
    }

    .set_up {
      font-size: 23px;
      color: rgb(153, 153, 153);
    }
  }
}

.content_div {
  width: 100%;
  // height: 60vh;
  background: #fff;
  box-sizing: border-box;
  padding: 20px;

  .info_table {
    width: 100%;
    height: calc(100% - 20px);
    display: flex;

    .div_tree {
      width: 150px;
      height: calc(100% - 50px);
      box-sizing: border-box;
      padding: 5px 0;
      border: 1px solid #e3e3e3;
      transition: all 0.3s;

      .tree_div1 {
        width: 100%;
        box-sizing: border-box;
        padding: 0 10px;
        display: flex;
        align-items: center;
        justify-content: space-between;

        p {
          color: #666666;
          font-size: 12px;
        }
      }

      .tree_input {
        width: 100%;
        height: 30px;
        margin-top: 10px;
        box-sizing: border-box;
        padding: 0 10px;

        p {
          width: 100%;
          height: 30px;
          margin: 0;
          box-sizing: border-box;
          border: 1px solid #dddddd;
          display: flex;
          align-items: center;
          position: relative;

          input {
            width: 100%;
            box-sizing: border-box;
            padding: 0 3px;
            height: 28px;
            border: none;
            font-size: 12px;

            &:focus {
              outline: none;
            }
          }

          span {
            position: absolute;
            right: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 25px;
            height: 28px;
            background: #fff;

            .el-icon-search {
              font-size: 16px;
              color: rgb(211, 211, 211);
            }
          }
        }
      }

      .tree_structure {
        width: 100%;
        height: calc(100% - 70px);
        box-sizing: border-box;
        padding: 0 0.168761rem;
        margin-top: 0.131258rem;
        overflow: auto;

        ::v-deep .el-tree {
          width: 100%;

          .el-tree-node__children {
            .el-tree-node__label {
              color: #666;
              font-weight: normal;
            }
          }

          .el-tree-node__label {
            font-size: 12px;
            font-weight: 600;
          }

          .is-current {
            .el-tree-node__content {
              background-color: #e6f7ff;
            }
          }

          .el-tree-node__content > .el-tree-node__expand-icon {
            padding-left: 0;
          }
        }
      }
    }

    .div_table {
      width: calc(100% - 160px);
      height: 100%;
      margin-left: 0.187512rem;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      transition: all 0.3s;

      .table_content {
        height: calc(100% - 50px);

        ::v-deep .el-table {
          border: 1px solid #e3e3e3;
          box-sizing: border-box;

          th,
          td {
            padding: 0;
            color: #666;
            box-sizing: border-box;
            border-right: 1px solid #e3e3e3;

            .cell {
              min-height: 30px;
              display: flex;
              align-items: center;
              font-size: 12px;
            }

            &:first-child {
              .cell {
                justify-content: center;
              }
            }

            &:last-child {
              border-right: none;
            }
          }

          th {
            .cell {
              background: #ededed;
              justify-content: center;
            }
          }

          .el-table__body tr:hover > td {
            background: #e3f6ff;
          }

          .el-table__footer-wrapper {
            td {
              background: #f4f4f4;
              border: none;
            }
          }

          //滚动条的宽度
          ::-webkit-scrollbar {
            width: 10px;
            height: 10px;
            background-color: #e5e5e5;
          }

          //滚动条的滑块
          ::-webkit-scrollbar-thumb {
            background-color: #c9c9c9;
          }
        }
      }

      .table_pagination {
        width: 100%;
        height: 50px;
        box-sizing: border-box;
        padding: 12px 0;
        display: flex;

        .total_div {
          line-height: 30px;
          font-size: 12px;
          color: #666;
          margin: 0;
          white-space: nowrap;
        }

        .pagination_div {
          flex: 1;
          display: flex;
          align-items: center;
          justify-content: flex-end;

          ::v-deep .el-pagination {
            padding: 0;
            height: 30px;

            .el-pagination__sizes {
              margin: 0;

              .el-input {
                margin-right: 0;
              }
            }
          }
        }
      }
    }
  }

  .info_button {
    width: 100%;
    height: 50px;
    display: flex;
    justify-content: space-between;

    ::v-deep .el-button {
      width: 60px;
      height: 30px;
      display: flex;
      justify-content: center;
      align-items: center;
      border-radius: 5px;
    }
  }
}

::v-deep .select_row {
  background-color: #e3f6ff !important;
}
</style>